﻿using System.Threading.Tasks;

namespace RotovapPlatform.Domain.Equipment.Interfaces.Services
{
	/// <summary>
	/// IO模块服务接口
	/// 负责与底层硬件IO通信
	/// </summary>
	public interface IIOModuleService
	{
		/// <summary>
		/// 读取所有DI信号状态
		/// </summary>
		/// <returns>位掩码表示的DI状态</returns>
		Task<int> ReadAllDIAsync();

		/// <summary>
		/// 写入指定DO信号状态
		/// </summary>
		/// <param name="channel">DO通道编号</param>
		/// <param name="state">信号状态值</param>
		/// <returns>操作是否成功</returns>
		Task<bool> WriteDOAsync(int channel, bool state);


		/// <summary>
		/// 读取指定DO信号状态（回读）
		/// </summary>
		/// <param name="channel">DO通道编号</param>
		/// <returns>信号状态值</returns>
		Task<bool> ReadDOAsync(int channel);

		/// <summary>
		/// 读取模拟输入信号值
		/// </summary>
		/// <param name="channel">AI通道编号</param>
		/// <returns>模拟信号值</returns>
		Task<double> ReadAIAsync(int channel);

		/// <summary>
		/// 获取冷凝器压力值（模拟信号）
		/// </summary>
		/// <returns>压力值，单位：mbar</returns>
		Task<double> GetCondenserPressureAsync();
	}
}